
#include "trace.h"

void _meas_time_start(struct timeval *tm)
{
#if DEBUG_PERF
    gettimeofday(tm, NULL);
#endif
}

void _meas_time_stop(struct timeval start_time, const char *str)
{
#if DEBUG_PERF
    struct timeval tm;
    double time_ms;

    gettimeofday(&tm, NULL);

    time_ms = (tm.tv_sec - start_time.tv_sec) * 1000.0 + (tm.tv_usec - start_time.tv_usec) / 1000.0;
    printf("PERF:%s %f ms\n", str, time_ms);
#endif
}
